import React from 'react'
import ReactDom from 'react-dom'
import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import { Provider, connect } from 'react-redux'
import { BrowserRouter, Route, Link, Redirect, Switch } from 'react-router-dom'
//import { counter } from './index.redux'
import './config'
import reducer from './reducer'
import Auth from './Auth'
import Dashboard from './Dashboard'
const store = createStore(reducer, compose(
    applyMiddleware(thunk),
    window.devToolsExtension()
))
//console.log(store.getState())
//store.subscribe(render)

ReactDom.render((
    <Provider store={store}>
        <BrowserRouter>
            <Switch>
                <Route path="/login" component={Auth} />
                <Route path="/dashboard" component={Dashboard} />
                <Route component={() => <h1>404</h1>}></Route>
            </Switch>
        </BrowserRouter>
    </Provider>
), document.getElementById('root'))
//function render(){
//    ReactDom.render(<App store={store}/>,document.getElementById('root'))
//}
//render()